#
# Download the Nitix Virtual Server 1.0.0 package and turn it into a
# VersaBox package.
#

ALL=filesystem.tar scripts.tar pre.ini vip.ini

all: NVS-1.0.0.pkg

.PRECIOUS: nvs-1.0.0.tar
nvs-1.0.0.tar:
	rm -f $@
	wget -O $@.bak http://www.nitix.com/downloads/nvs/nvs-1.0.0.tar
	mv $@.bak $@
	
.PRECIOUS: filesystem.tar.gz
filesystem.tar.gz: nvs-1.0.0.tar
	tar -xvf $^ $@
	touch $@

.PRECIOUS: filesystem.tar
filesystem.tar: filesystem.tar.gz
	rm -f $@
	gunzip <$^ >$@.bak
	mv $@.bak $@

.PRECIOUS: nvs.vip
nvs.vip: ${ALL}
	rm -f $@
	zip $@ ${ALL}

# Always rebuild this: it depends on the whole versabox package, which
# might have changed.
.PHONY: NVS-1.0.0.pkg
NVS-1.0.0.pkg: nvs.vip
	../../versapack $^ $@

clean:
	rm -rf NVS-1.0.0.pkg 
	rm -f nvs-1.0.0.tar nvs.vip filesystem.tar filesystem.tar.gz *~
